package com.ideaaedi.commonmp.injector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.ideaaedi.commonmp.mapper.BaseMapperExt;
import org.apache.ibatis.session.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 自定义sql注入器
 */
@Component
public class MybatisPlusSqlInjector extends DefaultSqlInjector {
    
    @Override
    public List<AbstractMethod> getMethodList(Configuration configuration, Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(configuration, mapperClass, tableInfo);
        methodList.add(new BaseMapperExt.ForceSelectById());
        methodList.add(new BaseMapperExt.ForceSelectByIds());
        methodList.add(new BaseMapperExt.ForceSelectCount());
        methodList.add(new BaseMapperExt.ForceSelectList());
        methodList.add(new BaseMapperExt.ForceDeleteById());
        methodList.add(new BaseMapperExt.ForceDeleteByIds());
        methodList.add(new BaseMapperExt.ForceDelete());
        return methodList;
    }
}